package gouroutine_pool

import (
	"sync"
	"time"
)

type TaskPool struct {
}

var taskPool = sync.Pool{New: func() interface{} {
	return new(Task)
}}

func (t *TaskPool) Get() *Task {
	p := taskPool.Get().(Task)
	return &p
}

func (t *TaskPool) Put(task Task) {
	taskPool.Put(task)
}

func (t *TaskPool) NewTask(run runFunc, param interface{}, timeOut int, timeUnit time.Duration, callBack runFunc, mata string) *Task {
	return t.Get()
}
